<extend name="Base/common"/>
<block name="body">
    <link rel="stylesheet" href="__PUBLIC__/aliyun-oss/ossuploader/jquery.ossuploader.css">
    <link rel="stylesheet" href="__PUBLIC__/libs/cropper/cropper.min.css">
    <div class="page page-wish-add page-space-top">
        <header>
            <div class="container">
                <h4 class="text-center" style="min-height: 35px;">
                    {:C('WEB_SITE_TITLE')}
                </h4>
                <div class="row">
                    <div class="col-sm-12">
                        <img src="{:showFileUrl(C('POSTER_COVER'))}" alt="">
                    </div>
                </div>
            </div>
        </header>
        <div class="container" style="min-height: 60px;">
            <div class="panel-data">
                <div>
                    <img src="__PUBLIC__/img/cj.png" alt="">
                    <span>活动倒计时</span> &nbsp;
                    <span class="datetime-show">15</span>:
                    <span class="datetime-show">15</span>:
                    <span class="datetime-show">15</span>
                    <span style="float: right">中奖公告></span>
                </div>
            </div>
        </div>
        <main class="container">
            <form action=""  id="data-form-id" method="post">
                <div class="panel">
                    <div class="form-group-name text-center">
                        个人信息
                    </div>
                    <div class="form-group">
                        <div class="field-name">
                            <span class="color-place">*</span>&nbsp;客户姓名
                        </div>
                        <div class="form-field">
                            <input type="text" name="name" placeholder="请输入姓名">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="field-name">
                            <span class="color-place">*</span>&nbsp;手机号
                        </div>
                        <div class="form-field">
                            <input type="text" name="phone" placeholder="请输入手机号">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="field-name">
                            <span class="color-place">*</span>&nbsp;身份证号
                        </div>
                        <div class="form-field">
                            <input type="text" name="code" placeholder="请输入身份证号">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="field-name">
                            <span class="color-place">*</span>&nbsp;指标编码
                        </div>
                        <div class="form-field">
                            <input type="text" name="number" placeholder="请输入指标编码">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="field-name">
                            <span class="color-place">*</span>&nbsp;车辆型号
                        </div>
                        <div class="form-field">
                            <select name="vehicle_id">
                                <option value="">请选择车辆型号</option>
                                <volist name="vehicle" id="vo">
                                    <option value="{$key}">{$vo}</option>
                                </volist>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="field-name">
                            <span class="color-place">*</span>&nbsp;购车门店
                        </div>
                        <div class="form-field">
                            <select name="shop_id">
                                <option value="">请选择购车门店</option>
                                <volist name="shop" id="vo">
                                    <option value="{$key}">{$vo}</option>
                                </volist>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="flex-center" style="width: 150px;margin: 0 auto;">
                    <button type="submit" class="btn btn-red btn-block btn-m" id="submit_data">去抽奖</button>
                </div>
            </form>
        </main>

    </div>
</block>

<block name="script">
    <script src="__PUBLIC__/aliyun-oss/cropper/cropper.min.js"></script>
    <script src="__PUBLIC__/libs/plupload-2.1.2/js/plupload.full.min.js"></script>
    <script src="__PUBLIC__/libs/ossuploader/canvas-to-blob.min.js"></script>
    <script>
        $(function () {
            $('#submit_data').on('click',function (e) {
                e.preventDefault();
                $.ajax({
                    type: "POST",
                    url: "{:U('add')}",
                    data: $('#data-form-id').serializeArray(),
                    dataType: 'json',
                    success: function(msg){
                        if (msg.status == 1){
                            if (msg.url){
                                window.location = msg.url
                            } else {
                                window.location.reload();
                            }
                        } else {
                            $.msgBox({
                                title: "提示",
                                content:msg.info,
                            });
                        }
                    }
                });
            }); 
        });
    </script>
</block>
